<template>
  <dv-scroll-ranking-board :config="config1" :key="refreshKey" style="width:90%;height:130px;margin-left: 20px;" />
</template>

<script>
import axios from 'axios';

export default {
  data() {
    return {
      config1: {
        data: []
      },
      refreshKey: 0 // 用于强制重新渲染
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    // 发请求
    async getData() {
      try {
        const res = await axios.get('http://localhost:8080/data/product/category/rank');
        this.config1.data = res.data.data;
        this.refreshKey += 1; // 更新key强制重新渲染
      } catch (err) {
        console.log(err);
      }
    }
  }
};
</script>

<style>
</style>
